package com.nbjtjc.safe.mapper.edu;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import com.nbjtjc.safe.model.edu.EduDailyExamineScore;
import com.nbjtjc.safe.model.edu.EduDailyParticipant;
import com.nbjtjc.util.MyMapper;
@Mapper
public interface EduDailyParticipantMapper extends MyMapper<EduDailyParticipant> {
	List<EduDailyParticipant> search(@Param("edp")EduDailyParticipant eduDailyParticipant);
	
	List<EduDailyParticipant> searchDetail(@Param("edp")EduDailyParticipant eduDailyParticipant);

//	@Select("select * from edu_daily_participant where edu_daily_info_id = #{infoId}")
	List<EduDailyParticipant> findByInfoId(@Param("infoId")int infoId);
	
	List<EduDailyParticipant> findDetailByInfoId(@Param("infoId")int infoId);
	
	@Select("select * from edu_daily_participant where  participate = 1 and user_id IS NOT NULL AND edu_daily_info_id = #{infoId}")
	List<EduDailyParticipant> findParticipantByInfoId(@Param("infoId")int infoId);
	
	@Delete("delete from edu_daily_participant where edu_daily_info_id = #{infoId}")
	int deleteByInfoId(@Param("infoId")int infoId);
	
	@Delete("delete from edu_daily_participant where edu_daily_info_id = #{infoId}")
	int deleteByInfoIdAndCompId(@Param("infoId")int infoId,@Param("CompId")int CompId);

	@Update("update edu_daily_participant set cancel = 1 where edu_daily_info_id = #{infoId}")
	int cancelByInfoId(@Param("infoId") int infoId);
	

}